# 定义动物类
class Animal:
    def __init__(self,name,age):
        self.name = name
        self.age =age
    def eat(self):
        print(f'{self.name} can eat')
    def sleep(self):
        print(f'{self.name} can sleep')

# 定义猫类，继承动物类，并增加抓老鼠的行为
class Cat(Animal):
    def __init__(self,name,age):
        super().__init__(name,age)
    def catch_rat(self):
        print(f'{self.name} can catch rats')
# 定义狗类，继承动物类，并增加看门的行为
class Dog(Animal):
    def __init__(self,name,age):
        super().__init__(name,age)
    def guard(self):
        print(f'{self.name} can guard yard')

# 定义神狗类，继承Dog,增加飞天功能
class GodDog(Dog):
    def __init__(self,name,age):
        super().__init__(name,age)
    def fly(self):
        print(f'{self.name} can fly')
    


print('------')
ani=Animal('Anny',3)
ani.eat()
ani.sleep()
print('------')
cat=Cat('kity',2)
cat.eat()
cat.sleep()
cat.catch_rat()
print('------')
dog=Dog('nigger',1)
dog.eat()
dog.sleep()
dog.guard()
print('------')
xiaotian=GodDog('xiaotian',200)
xiaotian.eat()
xiaotian.sleep()
xiaotian.fly()
